import { reqListAllInfo } from '@/api/upload/upload';

const state = {
  uploadLogList: [],
};

const mutations = {
  SET_UPLOAD_LOG_LIST(state, uploadLogList) {
    state.uploadLogList = uploadLogList;
  },
};

const actions = {
  async fetchUploadLogList({ commit }) {
    try {
      const result = await reqListAllInfo();
      if (result.code === 200) {
        commit("SET_UPLOAD_LOG_LIST", result.data);
      } else {
        throw new Error('fail');
      }
    } catch (error) {
      console.error(error);
    }
  },
};

const getters = {};

export default {
  namespaced: true,
  state,
  mutations,
  actions,
  getters,
};
